#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<sys/wait.h>
#include<sys/stat.h>
#include<fcntl.h>

int main(){
    int fd = open("myfifo", O_RDONLY);
    if(fd < 0){
        perror("open");
        exit(1);
    }

    printf("open read fifo succsess!\n");
    while(1){
        char buff[1024];
        int len = read(fd, buff, sizeof(buff));
        if(len > 0){
            buff[len] = '\0';
            printf("read from fifo: %s\n", buff);
        }else{
            break;
        }
    }
    return 0;
}